<template>
  <div class="carousel">
    <swiper :options="swiperOption" v-if="changdu">
      <!-- slides -->
      <swiper-slide v-for="item of list" :key="item.id"><img :src="item.imgurl"></swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'SwiperLunbo',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        autoplay: {
          delay: 2000,
          disableOnInteraction: false
        },
        pagination: {
          el: '.swiper-pagination',
          clickable: true
        },
        loop: true
      }
    }
  },
  computed: {
    changdu () {
      return this.list.length > 0
    }
  }
}
</script>

<style lang="stylus" scoped="scoped">
  .carousel >>> .swiper-pagination-bullet-active
   background-color #fff
  .carousel
   img
    width 100%
</style>
